/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.hl7.v3.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.hl7.v3.CE;
import org.hl7.v3.CS1;
import org.hl7.v3.II;
import org.hl7.v3.IVLTS;
import org.hl7.v3.POCDMT000040EncompassingEncounter;
import org.hl7.v3.POCDMT000040EncounterParticipant;
import org.hl7.v3.POCDMT000040InfrastructureRootTypeId;
import org.hl7.v3.POCDMT000040Location;
import org.hl7.v3.POCDMT000040ResponsibleParty;
import org.hl7.v3.V3Factory;
import org.hl7.v3.V3Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>POCDMT000040 Encompassing Encounter</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getRealmCode <em>Realm Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getTypeId <em>Type Id</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getTemplateId <em>Template Id</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getId <em>Id</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getCode <em>Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getEffectiveTime <em>Effective Time</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getDischargeDispositionCode <em>Discharge Disposition Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getResponsibleParty <em>Responsible Party</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getEncounterParticipant <em>Encounter Participant</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getLocation <em>Location</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getClassCode <em>Class Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getMoodCode <em>Mood Code</em>}</li>
 *   <li>{@link org.hl7.v3.impl.POCDMT000040EncompassingEncounterImpl#getNullFlavor <em>Null Flavor</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class POCDMT000040EncompassingEncounterImpl extends EObjectImpl implements POCDMT000040EncompassingEncounter {
	/**
	 * The cached value of the '{@link #getRealmCode() <em>Realm Code</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRealmCode()
	 * @generated
	 * @ordered
	 */
	protected EList<CS1> realmCode;

	/**
	 * The cached value of the '{@link #getTypeId() <em>Type Id</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTypeId()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040InfrastructureRootTypeId typeId;

	/**
	 * The cached value of the '{@link #getTemplateId() <em>Template Id</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getTemplateId()
	 * @generated
	 * @ordered
	 */
	protected EList<II> templateId;

	/**
	 * The cached value of the '{@link #getId() <em>Id</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getId()
	 * @generated
	 * @ordered
	 */
	protected EList<II> id;

	/**
	 * The cached value of the '{@link #getCode() <em>Code</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCode()
	 * @generated
	 * @ordered
	 */
	protected CE code;

	/**
	 * The cached value of the '{@link #getEffectiveTime() <em>Effective Time</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEffectiveTime()
	 * @generated
	 * @ordered
	 */
	protected IVLTS effectiveTime;

	/**
	 * The cached value of the '{@link #getDischargeDispositionCode() <em>Discharge Disposition Code</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDischargeDispositionCode()
	 * @generated
	 * @ordered
	 */
	protected CE dischargeDispositionCode;

	/**
	 * The cached value of the '{@link #getResponsibleParty() <em>Responsible Party</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getResponsibleParty()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040ResponsibleParty responsibleParty;

	/**
	 * The cached value of the '{@link #getEncounterParticipant() <em>Encounter Participant</em>}' containment reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEncounterParticipant()
	 * @generated
	 * @ordered
	 */
	protected EList<POCDMT000040EncounterParticipant> encounterParticipant;

	/**
	 * The cached value of the '{@link #getLocation() <em>Location</em>}' containment reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getLocation()
	 * @generated
	 * @ordered
	 */
	protected POCDMT000040Location location;

	/**
	 * The default value of the '{@link #getClassCode() <em>Class Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClassCode()
	 * @generated
	 * @ordered
	 */
	protected static final Enumerator CLASS_CODE_EDEFAULT = (Enumerator)V3Factory.eINSTANCE.createFromString(V3Package.eINSTANCE.getActClass(), "ENC");

	/**
	 * The cached value of the '{@link #getClassCode() <em>Class Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClassCode()
	 * @generated
	 * @ordered
	 */
	protected Enumerator classCode = CLASS_CODE_EDEFAULT;

	/**
	 * This is true if the Class Code attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean classCodeESet;

	/**
	 * The default value of the '{@link #getMoodCode() <em>Mood Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMoodCode()
	 * @generated
	 * @ordered
	 */
	protected static final Enumerator MOOD_CODE_EDEFAULT = (Enumerator)V3Factory.eINSTANCE.createFromString(V3Package.eINSTANCE.getActMood(), "EVN");

	/**
	 * The cached value of the '{@link #getMoodCode() <em>Mood Code</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMoodCode()
	 * @generated
	 * @ordered
	 */
	protected Enumerator moodCode = MOOD_CODE_EDEFAULT;

	/**
	 * This is true if the Mood Code attribute has been set.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 * @ordered
	 */
	protected boolean moodCodeESet;

	/**
	 * The default value of the '{@link #getNullFlavor() <em>Null Flavor</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullFlavor()
	 * @generated
	 * @ordered
	 */
	protected static final Enumerator NULL_FLAVOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNullFlavor() <em>Null Flavor</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNullFlavor()
	 * @generated
	 * @ordered
	 */
	protected Enumerator nullFlavor = NULL_FLAVOR_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected POCDMT000040EncompassingEncounterImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return V3Package.eINSTANCE.getPOCDMT000040EncompassingEncounter();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<CS1> getRealmCode() {
		if (realmCode == null) {
			realmCode = new EObjectContainmentEList<CS1>(CS1.class, this, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE);
		}
		return realmCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040InfrastructureRootTypeId getTypeId() {
		return typeId;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetTypeId(POCDMT000040InfrastructureRootTypeId newTypeId, NotificationChain msgs) {
		POCDMT000040InfrastructureRootTypeId oldTypeId = typeId;
		typeId = newTypeId;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID, oldTypeId, newTypeId);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setTypeId(POCDMT000040InfrastructureRootTypeId newTypeId) {
		if (newTypeId != typeId) {
			NotificationChain msgs = null;
			if (typeId != null)
				msgs = ((InternalEObject)typeId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID, null, msgs);
			if (newTypeId != null)
				msgs = ((InternalEObject)newTypeId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID, null, msgs);
			msgs = basicSetTypeId(newTypeId, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID, newTypeId, newTypeId));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<II> getTemplateId() {
		if (templateId == null) {
			templateId = new EObjectContainmentEList<II>(II.class, this, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID);
		}
		return templateId;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<II> getId() {
		if (id == null) {
			id = new EObjectContainmentEList<II>(II.class, this, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID);
		}
		return id;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CE getCode() {
		return code;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetCode(CE newCode, NotificationChain msgs) {
		CE oldCode = code;
		code = newCode;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE, oldCode, newCode);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCode(CE newCode) {
		if (newCode != code) {
			NotificationChain msgs = null;
			if (code != null)
				msgs = ((InternalEObject)code).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE, null, msgs);
			if (newCode != null)
				msgs = ((InternalEObject)newCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE, null, msgs);
			msgs = basicSetCode(newCode, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE, newCode, newCode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public IVLTS getEffectiveTime() {
		return effectiveTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetEffectiveTime(IVLTS newEffectiveTime, NotificationChain msgs) {
		IVLTS oldEffectiveTime = effectiveTime;
		effectiveTime = newEffectiveTime;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME, oldEffectiveTime, newEffectiveTime);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEffectiveTime(IVLTS newEffectiveTime) {
		if (newEffectiveTime != effectiveTime) {
			NotificationChain msgs = null;
			if (effectiveTime != null)
				msgs = ((InternalEObject)effectiveTime).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME, null, msgs);
			if (newEffectiveTime != null)
				msgs = ((InternalEObject)newEffectiveTime).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME, null, msgs);
			msgs = basicSetEffectiveTime(newEffectiveTime, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME, newEffectiveTime, newEffectiveTime));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CE getDischargeDispositionCode() {
		return dischargeDispositionCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetDischargeDispositionCode(CE newDischargeDispositionCode, NotificationChain msgs) {
		CE oldDischargeDispositionCode = dischargeDispositionCode;
		dischargeDispositionCode = newDischargeDispositionCode;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE, oldDischargeDispositionCode, newDischargeDispositionCode);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDischargeDispositionCode(CE newDischargeDispositionCode) {
		if (newDischargeDispositionCode != dischargeDispositionCode) {
			NotificationChain msgs = null;
			if (dischargeDispositionCode != null)
				msgs = ((InternalEObject)dischargeDispositionCode).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE, null, msgs);
			if (newDischargeDispositionCode != null)
				msgs = ((InternalEObject)newDischargeDispositionCode).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE, null, msgs);
			msgs = basicSetDischargeDispositionCode(newDischargeDispositionCode, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE, newDischargeDispositionCode, newDischargeDispositionCode));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040ResponsibleParty getResponsibleParty() {
		return responsibleParty;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetResponsibleParty(POCDMT000040ResponsibleParty newResponsibleParty, NotificationChain msgs) {
		POCDMT000040ResponsibleParty oldResponsibleParty = responsibleParty;
		responsibleParty = newResponsibleParty;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY, oldResponsibleParty, newResponsibleParty);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setResponsibleParty(POCDMT000040ResponsibleParty newResponsibleParty) {
		if (newResponsibleParty != responsibleParty) {
			NotificationChain msgs = null;
			if (responsibleParty != null)
				msgs = ((InternalEObject)responsibleParty).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY, null, msgs);
			if (newResponsibleParty != null)
				msgs = ((InternalEObject)newResponsibleParty).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY, null, msgs);
			msgs = basicSetResponsibleParty(newResponsibleParty, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY, newResponsibleParty, newResponsibleParty));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<POCDMT000040EncounterParticipant> getEncounterParticipant() {
		if (encounterParticipant == null) {
			encounterParticipant = new EObjectContainmentEList<POCDMT000040EncounterParticipant>(POCDMT000040EncounterParticipant.class, this, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT);
		}
		return encounterParticipant;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public POCDMT000040Location getLocation() {
		return location;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetLocation(POCDMT000040Location newLocation, NotificationChain msgs) {
		POCDMT000040Location oldLocation = location;
		location = newLocation;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION, oldLocation, newLocation);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setLocation(POCDMT000040Location newLocation) {
		if (newLocation != location) {
			NotificationChain msgs = null;
			if (location != null)
				msgs = ((InternalEObject)location).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION, null, msgs);
			if (newLocation != null)
				msgs = ((InternalEObject)newLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION, null, msgs);
			msgs = basicSetLocation(newLocation, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION, newLocation, newLocation));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Enumerator getClassCode() {
		return classCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setClassCode(Enumerator newClassCode) {
		Enumerator oldClassCode = classCode;
		classCode = newClassCode;
		boolean oldClassCodeESet = classCodeESet;
		classCodeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE, oldClassCode, classCode, !oldClassCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetClassCode() {
		Enumerator oldClassCode = classCode;
		boolean oldClassCodeESet = classCodeESet;
		classCode = CLASS_CODE_EDEFAULT;
		classCodeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE, oldClassCode, CLASS_CODE_EDEFAULT, oldClassCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetClassCode() {
		return classCodeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Enumerator getMoodCode() {
		return moodCode;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMoodCode(Enumerator newMoodCode) {
		Enumerator oldMoodCode = moodCode;
		moodCode = newMoodCode;
		boolean oldMoodCodeESet = moodCodeESet;
		moodCodeESet = true;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE, oldMoodCode, moodCode, !oldMoodCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void unsetMoodCode() {
		Enumerator oldMoodCode = moodCode;
		boolean oldMoodCodeESet = moodCodeESet;
		moodCode = MOOD_CODE_EDEFAULT;
		moodCodeESet = false;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.UNSET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE, oldMoodCode, MOOD_CODE_EDEFAULT, oldMoodCodeESet));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isSetMoodCode() {
		return moodCodeESet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Enumerator getNullFlavor() {
		return nullFlavor;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNullFlavor(Enumerator newNullFlavor) {
		Enumerator oldNullFlavor = nullFlavor;
		nullFlavor = newNullFlavor;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__NULL_FLAVOR, oldNullFlavor, nullFlavor));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE:
				return ((InternalEList<?>)getRealmCode()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID:
				return basicSetTypeId(null, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID:
				return ((InternalEList<?>)getTemplateId()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID:
				return ((InternalEList<?>)getId()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE:
				return basicSetCode(null, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME:
				return basicSetEffectiveTime(null, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE:
				return basicSetDischargeDispositionCode(null, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY:
				return basicSetResponsibleParty(null, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT:
				return ((InternalEList<?>)getEncounterParticipant()).basicRemove(otherEnd, msgs);
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION:
				return basicSetLocation(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE:
				return getRealmCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID:
				return getTypeId();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID:
				return getTemplateId();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID:
				return getId();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE:
				return getCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME:
				return getEffectiveTime();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE:
				return getDischargeDispositionCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY:
				return getResponsibleParty();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT:
				return getEncounterParticipant();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION:
				return getLocation();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE:
				return getClassCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE:
				return getMoodCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__NULL_FLAVOR:
				return getNullFlavor();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE:
				getRealmCode().clear();
				getRealmCode().addAll((Collection<? extends CS1>)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID:
				setTypeId((POCDMT000040InfrastructureRootTypeId)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID:
				getTemplateId().clear();
				getTemplateId().addAll((Collection<? extends II>)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID:
				getId().clear();
				getId().addAll((Collection<? extends II>)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE:
				setCode((CE)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME:
				setEffectiveTime((IVLTS)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE:
				setDischargeDispositionCode((CE)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY:
				setResponsibleParty((POCDMT000040ResponsibleParty)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT:
				getEncounterParticipant().clear();
				getEncounterParticipant().addAll((Collection<? extends POCDMT000040EncounterParticipant>)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION:
				setLocation((POCDMT000040Location)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE:
				setClassCode((Enumerator)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE:
				setMoodCode((Enumerator)newValue);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__NULL_FLAVOR:
				setNullFlavor((Enumerator)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE:
				getRealmCode().clear();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID:
				setTypeId((POCDMT000040InfrastructureRootTypeId)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID:
				getTemplateId().clear();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID:
				getId().clear();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE:
				setCode((CE)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME:
				setEffectiveTime((IVLTS)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE:
				setDischargeDispositionCode((CE)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY:
				setResponsibleParty((POCDMT000040ResponsibleParty)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT:
				getEncounterParticipant().clear();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION:
				setLocation((POCDMT000040Location)null);
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE:
				unsetClassCode();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE:
				unsetMoodCode();
				return;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__NULL_FLAVOR:
				setNullFlavor(NULL_FLAVOR_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__REALM_CODE:
				return realmCode != null && !realmCode.isEmpty();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TYPE_ID:
				return typeId != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__TEMPLATE_ID:
				return templateId != null && !templateId.isEmpty();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ID:
				return id != null && !id.isEmpty();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CODE:
				return code != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__EFFECTIVE_TIME:
				return effectiveTime != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__DISCHARGE_DISPOSITION_CODE:
				return dischargeDispositionCode != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__RESPONSIBLE_PARTY:
				return responsibleParty != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__ENCOUNTER_PARTICIPANT:
				return encounterParticipant != null && !encounterParticipant.isEmpty();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__LOCATION:
				return location != null;
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__CLASS_CODE:
				return isSetClassCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__MOOD_CODE:
				return isSetMoodCode();
			case V3Package.POCDMT000040_ENCOMPASSING_ENCOUNTER__NULL_FLAVOR:
				return NULL_FLAVOR_EDEFAULT == null ? nullFlavor != null : !NULL_FLAVOR_EDEFAULT.equals(nullFlavor);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (classCode: ");
		if (classCodeESet) result.append(classCode); else result.append("<unset>");
		result.append(", moodCode: ");
		if (moodCodeESet) result.append(moodCode); else result.append("<unset>");
		result.append(", nullFlavor: ");
		result.append(nullFlavor);
		result.append(')');
		return result.toString();
	}

} //POCDMT000040EncompassingEncounterImpl
